/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yogi.webframework.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author Yogi
 */
@Entity
@Table(name = "t_shop")
@NamedQueries({
    @NamedQuery(name = "Shop.findAll", query = "SELECT s FROM Shop s"),
    @NamedQuery(name = "Shop.findById", query = "SELECT s FROM Shop s WHERE s.id = :id"),
    @NamedQuery(name = "Shop.findByShopName", query = "SELECT s FROM Shop s WHERE s.shopName = :shopName"),
    @NamedQuery(name = "Shop.findByWebUrl", query = "SELECT s FROM Shop s WHERE s.webUrl = :webUrl"),
    @NamedQuery(name = "Shop.findByPhone", query = "SELECT s FROM Shop s WHERE s.phone = :phone"),
    @NamedQuery(name = "Shop.findByPhoneMobile", query = "SELECT s FROM Shop s WHERE s.phoneMobile = :phoneMobile"),
    @NamedQuery(name = "Shop.findByEmail", query = "SELECT s FROM Shop s WHERE s.email = :email"),
    @NamedQuery(name = "Shop.findByContactPerson", query = "SELECT s FROM Shop s WHERE s.contactPerson = :contactPerson"),
    @NamedQuery(name = "Shop.findByAccUsername", query = "SELECT s FROM Shop s WHERE s.accUsername = :accUsername"),
    @NamedQuery(name = "Shop.findByAccPassword", query = "SELECT s FROM Shop s WHERE s.accPassword = :accPassword"),
    @NamedQuery(name = "Shop.findByAccStatus", query = "SELECT s FROM Shop s WHERE s.accStatus = :accStatus")})
public class Shop implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "SHOP_NAME")
    private String shopName;
    @Column(name = "WEB_URL")
    private String webUrl;
    @Column(name = "PHONE")
    private String phone;
    @Column(name = "PHONE_MOBILE")
    private String phoneMobile;
    @Column(name = "EMAIL")
    private String email;
    @Column(name = "CONTACT_PERSON")
    private String contactPerson;
    @Column(name = "ACC_USERNAME")
    private String accUsername;
    @Column(name = "ACC_PASSWORD")
    private String accPassword;
    @Column(name = "ACC_STATUS")
    private String accStatus;
    @LazyCollection(LazyCollectionOption.FALSE)
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "shop")
    private List<Config> configList;
    @LazyCollection(LazyCollectionOption.FALSE)
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "shop")
    private List<Product> productList;

    public Shop() {
    }
    
    

    public Shop(String shopName) {
		super();
		this.shopName = shopName;
	}



	public Shop(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getShopName() {
        return shopName;
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    public String getWebUrl() {
        return webUrl;
    }

    public void setWebUrl(String webUrl) {
        this.webUrl = webUrl;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPhoneMobile() {
        return phoneMobile;
    }

    public void setPhoneMobile(String phoneMobile) {
        this.phoneMobile = phoneMobile;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public String getAccUsername() {
        return accUsername;
    }

    public void setAccUsername(String accUsername) {
        this.accUsername = accUsername;
    }

    public String getAccPassword() {
        return accPassword;
    }

    public void setAccPassword(String accPassword) {
        this.accPassword = accPassword;
    }

    public String getAccStatus() {
        return accStatus;
    }

    public void setAccStatus(String accStatus) {
        this.accStatus = accStatus;
    }

    public List<Config> getConfigList() {
        return configList;
    }

    public void setConfigList(List<Config> configList) {
        this.configList = configList;
    }

    public List<Product> getProductList() {
        return productList;
    }

    public void setProductList(List<Product> productList) {
        this.productList = productList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Shop)) {
            return false;
        }
        Shop other = (Shop) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }



	@Override
	public String toString() {
		return "Shop [accPassword=" + accPassword + ", accStatus=" + accStatus
				+ ", accUsername=" + accUsername + ", contactPerson="
				+ contactPerson + ", email=" + email + ", id=" + id
				+ ", phone=" + phone + ", phoneMobile=" + phoneMobile
				+ ", shopName=" + shopName + ", webUrl=" + webUrl + "]";
	}

    

}
